import Vue from 'vue';
export default {
    /*用户点赞*/
    doLikeApi(state,obj){
        let userId = this.getters.currentUserFn.userId;
        let menuId = obj.menuId || (this.getters.getterStoreMenu && this.getters.getterStoreMenu.menuId ? this.getters.getterStoreMenu.menuId : 0);
        let menuIdString = '';
        if(menuId){
            menuIdString = '&menuId='+menuId
        }
        let url = `${Vue.prototype.NW_API_API_LOCALE_VERSION}/like/user/${userId}/do?likeType=${obj.likeType}&likeKey=${obj.likeKey}${menuIdString}`;
        if(obj && !obj.isLike){
            url = `${Vue.prototype.NW_API_API_LOCALE_VERSION}/like/user/${userId}/cancel?likeType=${obj.likeType}&likeKey=${obj.likeKey}`;
        }
        Vue.prototype.xurl.put(url).then(data => {
            console.log(data);
        });
    }
}